/*
 * aclass_iap.h
 *
 *  Created on: 2022.03.04
 *      Author: taoye
 */

#ifndef PUBLIC_QUEUE_H_
#define PUBLIC_QUEUE_H_

#include "stdint.h"
#include "stddef.h"
#include "stdlib.h"
#include "string.h"

#define PUB_QUEUE_VERSION    "V0.0.1"

typedef struct {
    uint16_t len;
    uint16_t buf_len;
    uint16_t rPtr;
    uint16_t wPtr;
    uint8_t *buf;
} queue_t;

void        DataQueueInit       (queue_t *queue, uint8_t *buf, uint16_t buf_len);
void        DataQueueClear      (queue_t *queue);
uint8_t     DataQueueWriteByte  (queue_t *queue, uint8_t data);
uint8_t     DataQueueReadByte   (queue_t *queue, uint8_t *data);
uint8_t     DataQueueWrite      (queue_t *queue, uint8_t *data, uint16_t len);
uint8_t     DataQueueRead       (queue_t *queue, uint8_t *data, uint16_t len);
uint16_t    DataQueueGetLen     (queue_t *queue);
uint16_t    DataQueueGetBufLen  (queue_t *queue);

#endif
